package com.pug.service.hotel.category;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.pug.bo.HotelTypeBo;
import com.pug.entity.HotelType;
import com.pug.enums.StatusEnum;
import com.pug.mapper.hotel.HotelTypeMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 飞哥
 * @Title: 学相伴出品
 * @Description: 飞哥B站地址：https://space.bilibili.com/490711252
 * 记得关注和三连哦！
 * @Description: 我们有一个学习网站：https://www.kuangstudy.com
 * @date 2022/3/19$ 16:58$
 */
@Service
@Slf4j
public class HotelTypeServiceImpl extends ServiceImpl<HotelTypeMapper, HotelType> implements IHotelTypeService {

    /**
     * 根据酒店ID查询对应的房型列表信息
     *
     * @param hotelId
     * @return
     */
    @Override
    public List<HotelTypeBo> findByHotelId(Long hotelId) {
        LambdaQueryWrapper<HotelType> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.eq(HotelType::getHotelId,hotelId);
        lambdaQueryWrapper.eq(HotelType::getStatus, StatusEnum.YES.getValue());
        lambdaQueryWrapper.orderByAsc(HotelType::getSorted);
        return tranferListBo(this.list(lambdaQueryWrapper),HotelTypeBo.class);
    }
}
